(global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/sunui-upimg1/sunui-upimg1" ], {
    "05bc": function(t, i, r) {
        (function(n) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var t, s = (t = r("4795")) && t.__esModule ? t : {
                default: t
            };
            function a(t, e, i, n, r, s, u) {
                try {
                    var o = t[s](u), a = o.value;
                } catch (t) {
                    return i(t), 0;
                }
                o.done ? e(a) : Promise.resolve(a).then(n, r);
            }
            var e = {
                props: {
                    maxFileNumber: {
                        type: Number,
                        default: 9
                    },
                    btnName: {
                        type: String,
                        default: "添加照片"
                    },
                    size: {
                        type: Array,
                        default: function() {
                            return [ "222rpx", "222rpx" ];
                        }
                    },
                    beforeUpload: {
                        type: Function
                    },
                    items: {
                        type: Array,
                        default: function() {
                            return [];
                        }
                    },
                    closeBtnColor: {
                        type: String,
                        default: "#666666"
                    },
                    uploadServerUrl: {
                        type: String,
                        default: ""
                    },
                    progressSize: {
                        type: Number,
                        default: 1
                    },
                    progressColor: {
                        type: String,
                        default: "#27BD81"
                    },
                    progressBGColor: {
                        type: String,
                        default: "#F8F8F8"
                    },
                    fileName: {
                        type: String,
                        default: "img"
                    },
                    formData: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    },
                    imgMode: {
                        type: String,
                        default: "widthFix"
                    },
                    header: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    }
                },
                data: function() {
                    return {
                        imgLists: [],
                        updatting: !1
                    };
                },
                watch: {
                    imgLists: function(t, e) {
                        this.updatting || this.$emit("change", t);
                    }
                },
                methods: {
                    clearAllImgs: function() {
                        this.imgLists = [];
                    },
                    addImg: function() {
                        var o, e, r = this, t = this.maxFileNumber - this.imgLists.length;
                        if (t < 1) return !1;
                        n.chooseImage({
                            count: t,
                            sizeType: [ "compressed" ],
                            success: (o = s.default.mark(function t(e) {
                                var i, n;
                                return s.default.wrap(function(t) {
                                    for (;;) switch (t.prev = t.next) {
                                      case 0:
                                        i = e.tempFiles, n = 0;

                                      case 2:
                                        if (!(n < e.tempFilePaths.length)) {
                                            t.next = 13;
                                            break;
                                        }
                                        if (r.beforeUpload) return t.next = 6, r.beforeUpload(i[n], n);
                                        t.next = 9;
                                        break;

                                      case 6:
                                        if (!1 === t.sent) return t.abrupt("return", !1);
                                        t.next = 9;
                                        break;

                                      case 9:
                                        r.imgLists.push({
                                            url: e.tempFilePaths[n],
                                            progress: 0,
                                            error: !1
                                        });

                                      case 10:
                                        n++, t.next = 2;
                                        break;

                                      case 13:
                                      case "end":
                                        return t.stop();
                                    }
                                }, t);
                            }), e = function() {
                                var t = this, u = arguments;
                                return new Promise(function(e, i) {
                                    var n = o.apply(t, u);
                                    function r(t) {
                                        a(n, e, i, r, s, "next", t);
                                    }
                                    function s(t) {
                                        a(n, e, i, r, s, "throw", t);
                                    }
                                    r(void 0);
                                });
                            }, function(t) {
                                return e.apply(this, arguments);
                            }),
                            complete: function() {},
                            fail: function() {}
                        });
                    },
                    removeImg: function(t) {
                        t = t.currentTarget.id.replace("sunui-items-img-", ""), t = this.imgLists.splice(t, 1);
                        this.$emit("removeImg", t[0]);
                    },
                    showImgs: function(t) {
                        for (var t = t.currentTarget.dataset.imgurl, e = [], i = 0; i < this.imgLists.length; i++) e.push(this.imgLists[i].url);
                        n.previewImage({
                            urls: e,
                            current: t
                        });
                    },
                    upload: function(t) {
                        this.updatting || (this.updatting = !0, t = t || 0, n.showLoading({
                            title: "图片上传中"
                        }), this.uploadBase(t));
                    },
                    retry: function(t) {
                        t = t.currentTarget.dataset.index;
                        this.upload(t);
                    },
                    uploadBase: function(e) {
                        var i = this;
                        if (e > this.imgLists.length - 1) return n.hideLoading(), this.updatting = !1, void this.$emit("uploaded", this.imgLists);
                        "" != this.uploadServerUrl ? 1 <= this.imgLists[e].progress ? this.uploadBase(e + 1) : (this.imgLists[e].error = !1, 
                        n.uploadFile({
                            url: this.uploadServerUrl,
                            filePath: this.imgLists[e].url,
                            name: "file",
                            formData: this.formData,
                            header: this.header,
                            success: function(t) {
                                200 != t.statusCode ? (n.showToast({
                                    title: "上传失败 : " + t.data,
                                    icon: "none"
                                }), i.error(e)) : (i.imgLists[e].progress = 100, i.imgLists[e].url = t.data, i.imgLists[e].result = t, 
                                i.uploadBase(e + 1));
                            },
                            fail: function(t) {
                                n.showToast({
                                    title: "上传失败，请点击图片重试",
                                    icon: "none"
                                }), i.error(e);
                            }
                        }).onProgressUpdate(function(t) {
                            0 < t.progress && (i.imgLists[e].progress = t.progress, i.imgLists.splice(e, 1, i.imgLists[e]));
                        })) : n.showToast({
                            title: "请设置上传服务器地址",
                            icon: "none"
                        });
                    },
                    error: function(t) {
                        var e = this;
                        this.updatting = !1, setTimeout(function() {
                            e.imgLists[t].progress = 0, e.imgLists[t].error = !0, e.$emit("uploaderror");
                        }, 500);
                    },
                    setItems: function(t) {
                        this.imgLists = [];
                        for (var e = 0; e < t.length; e++) this.imgLists.push({
                            url: t[e],
                            progress: 100
                        });
                    }
                }
            };
            i.default = e;
        }).call(this, r("543d").default);
    },
    "5dcf": function(t, e, i) {
        i.r(e);
        var n, r = i("05bc"), s = i.n(r);
        for (n in r) "default" !== n && function(t) {
            i.d(e, t, function() {
                return r[t];
            });
        }(n);
        e.default = s.a;
    },
    "6bd8": function(t, e, i) {
        var n = i("c92e");
        i.n(n).a;
    },
    "9edd": function(t, e, i) {
        function n() {
            this.$createElement, this._self._c;
        }
        var r = [];
        i.d(e, "b", function() {
            return n;
        }), i.d(e, "c", function() {
            return r;
        }), i.d(e, "a", function() {});
    },
    b0f1: function(t, e, i) {
        i.r(e);
        var n, r = i("9edd"), s = i("5dcf");
        for (n in s) "default" !== n && function(t) {
            i.d(e, t, function() {
                return s[t];
            });
        }(n);
        i("6bd8");
        var u = i("f0c5"), r = Object(u.a)(s.default, r.b, r.c, !1, null, "1af30fdb", null, !1, r.a, void 0);
        e.default = r.exports;
    },
    c92e: function(t, e, i) {}
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/sunui-upimg1/sunui-upimg1-create-component", {
    "components/sunui-upimg1/sunui-upimg1-create-component": function(t, e, i) {
        i("543d").createComponent(i("b0f1"));
    }
}, [ [ "components/sunui-upimg1/sunui-upimg1-create-component" ] ] ]);